package upicgame.entity;

import org.hibernate.annotations.Type;
import upicgame.user.service.UserService;

import javax.persistence.*;

/**
 * @program: upicgame
 * @description: 文章实体类
 * @author: lhq
 * @create: 2020-01-03 08:58
 */
@Entity
@Table(name = "article")
public class Article {
	private Integer id;
	private String title;
	private String context;
	private User user;


	public Article() {
	}
	public Article(Integer id, String title, String context) {
		this.id = id;
		this.title = title;
		this.context = context;
	}

	@Override
	public String toString() {
		return "Article{" +
				"id=" + id +
				", title='" + title + '\'' +
				", context='" + context + '\'' +
				'}';
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	@Type(type = "text")
	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}
